package com.titar.robot;


import com.github.moduth.blockcanary.BlockCanary;
import com.squareup.leakcanary.LeakCanary;
import com.titar.robot.base.AbsSuperApplication;
import com.titar.robot.utils.CrashHandler;

public class RobotApp extends AbsSuperApplication {

    @Override
    public void onCreate() {
        super.onCreate();
        if (LeakCanary.isInAnalyzerProcess(this)) {
            return;
        }
        LeakCanary.install(this);
        initCrashHandler();

        BlockCanary.install(this, new AppBlockCanaryContext()).start();
    }

    private void initCrashHandler() {
        // CrashHandler.getInstance().init(this);
        CrashHandler catchHandler = CrashHandler.getInstance();
        catchHandler.init(getApplicationContext());//异常捕获初始化
    }

    @Override
    protected String getAppNameFromSub() {
        return this.getClass().getSimpleName();
    }

    public static Boolean isLife = false;//程序存活状态

    //判断是否活着
    public static Boolean getIsLife() {
        return isLife;
    }

    public static void setIsLife(Boolean isLife) {
        RobotApp.isLife = isLife;
    }
}
